package com.party.core.service.analysis.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.analysis.StatisticsEventCountReadDao;
import com.party.core.dao.write.analysis.StatisticsEventCountWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.analysis.StatisticsEventCounter;
import com.party.core.service.analysis.IStatisticsEventCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * @program: party-temp
 * @description: 统计事件流程接口实现
 * @author: Huaqunhao
 * @create: 2018-08-01 11:57
 **/

@Service
public class StatisticsEventCountService implements IStatisticsEventCountService {

    @Autowired
    private StatisticsEventCountWriteDao statisticsEventCountWriteDao;
    @Autowired
    private StatisticsEventCountReadDao statisticsEventCountReadDao;


    @Override
    public boolean batchInsert(List<StatisticsEventCounter> eventCounterList) {
        eventCounterList.stream().forEach(eventCounter -> BaseModel.preInsert(eventCounter));
        return statisticsEventCountWriteDao.batchInsert(eventCounterList);
    }

    @Override
    public String insert(StatisticsEventCounter eventCounter) {
        BaseModel.preInsert(eventCounter);
        return statisticsEventCountWriteDao.insert(eventCounter) ? eventCounter.getId() : null;
    }

    @Override
    public boolean update(StatisticsEventCounter eventCounter) {
        return eventCounter == null ? null : statisticsEventCountWriteDao.update(eventCounter);
    }

    @Override
    public boolean deleteLogic(String id) {
        return id == null ? false : statisticsEventCountWriteDao.deleteLogic(id);
    }

    @Override
    public boolean delete(String id) {
        return id == null ? false : statisticsEventCountWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return ids == null || ids.isEmpty() ? false : statisticsEventCountWriteDao.batchDeleteLogic(ids);
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return ids == null || ids.isEmpty() ? false : statisticsEventCountWriteDao.batchDelete(ids);
    }

    @Override
    public StatisticsEventCounter get(String id) {
        return id == null || id.isEmpty() ? null : statisticsEventCountReadDao.get(id);
    }

    @Override
    public List<StatisticsEventCounter> listPage(StatisticsEventCounter eventCounter, Page page) {
        return null;
    }

    @Override
    public List<StatisticsEventCounter> list(StatisticsEventCounter eventCounter) {
        return null;
    }

    @Override
    public List<StatisticsEventCounter> batchList(Set<String> ids, StatisticsEventCounter eventCounter, Page page) {
        return null;
    }
}
